package com.ctg.itrdc.imageconsole.util;

import javax.ws.rs.core.Response;

/**
 * 		Author			Date			Operation
 * 		Shizhu.Peng		2017-03-25		create
 */

public class ResponseUtil {
	
	public static void checkResponse(String destinationUrl, Response response) {
		if(null == response)
			throw new RuntimeException(String.format("Error : connection to %s has no response", destinationUrl));
		if(response.getStatus() >= 300)
			throw new RuntimeException(String.format("Error : connection to %s returns %d", destinationUrl, response.getStatus()));
	}
	
}
